package com.codeforces.contest.c34;

import java.util.Arrays;
import java.util.Scanner;

public class _34C {

	static Scanner scanner = new Scanner(System.in);
	static int[] num = new int[100];
	static int n,l,r;
	static String str;

	public static void main(String[] args) {
		str = scanner.next();
		String[] ss = str.split(",");
		n = 0;
		for (int i=0;i<ss.length;++i) {
			int val = Integer.parseInt(ss[i]);
			num[n] = val;
			n++;
		}
		Arrays.sort(num,0,n);
		l = r = num[0];
		for (int i=1;i<n;++i) {
			if (num[i-1] == num[i]) {
				continue;
			}
			else {
				if (num[i] == num[i-1] + 1) {
					r = num[i];
				}
				else {
					if (l == r) {
						System.out.print(l);
					}
					else {
						System.out.print(l + "-" + r);
					}
					System.out.print(",");
					l = r = num[i];
				}
			}
		}
		if (l == r) {
			System.out.print(l);
		}
		else {
			System.out.print(l + "-" + r);
		}
		System.out.println();

	}

}
